﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web;

namespace Ruandao.HostServer
{
    public class Ware
    {
        public string WareName { get; set; }

        public string AppPath { get;set;}

        public string Port { get; set; }

        public Dictionary<string, string> DynamicPathMaps { get; internal set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="url">相对路径（以当前请求的路径为基准）和绝对路径都可以。</param>
        /// <returns></returns>
        public  bool IsDynamicPath(string url)
        {
            string absolute = Ruandao.Misc.WebUtility.ToClientAbsoluteUrl(url);
            bool isDynamic = false;
            foreach (var map in this.DynamicPathMaps)
            {
                string path = VirtualPathUtility.ToAbsolute("~/") + map.Key;
                if (absolute.StartsWith(path,StringComparison.CurrentCultureIgnoreCase))
                {
                    isDynamic = true;
                    break;
                }
            }
            return isDynamic;
        }


    }
}
